C++ Basics

General

Fundamental types in C++ are divided into three categories:

  1. integral
  2. floating
  3. void

Integral types are capable of handling whole numbers. Floating types are capable of specifying values that may have fractional parts.

The void type describes an empty set of values. No variable of type void can be specified — it is used primarily to declare functions that return no values or to declare generic pointers to untyped or arbitrarily typed data. Any expression can be explicitly converted or cast to type void.

Several of the basic types can be modified using one or more of these type modifiers:

Signedness

  • signed - target type will have signed representation (this is the default if omitted)
  • unsigned - target type will have unsigned representation

Size

  • short - target type will be optimized for space and will have width of at least 16 bits.
  • long - target type will have width of at least 32 bits.